home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Interfaces / MPW Interfaces / CIncludes / Editions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  11.5 KB  |  367 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Editions.h
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. */
  11.  
  12. #ifndef __EDITIONS__
  13. #define __EDITIONS__
  14.  
  15. #ifndef __MEMORY__
  16. #include <Memory.h>
  17. #endif
  18.  
  19. #ifndef __TYPES__
  20. #include <Types.h>
  21. #endif
  22.  
  23. #ifndef __FILES__
  24. #include <Files.h>
  25. #endif
  26.  
  27. #ifndef __ALIASES__
  28. #include <Aliases.h>
  29. #endif
  30.  
  31. #ifndef __DIALOGS__
  32. #include <Dialogs.h>
  33. #endif
  34.  
  35.  
  36. enum {
  37.  
  38.  
  39. /* resource types  */
  40.  
  41. #define rSectionType 'sect'                /* ResType of saved SectionRecords */
  42.  
  43. /* section types */
  44.  
  45.  stSubscriber = 0x01,
  46.  stPublisher = 0x0A,
  47.  
  48.  sumAutomatic = 0,                        /* subscriber update mode - Automatically     */
  49.  sumManual = 1,                            /* subscriber update mode - Manually */
  50.  pumOnSave = 0,                            /* publisher update mode - OnSave            */
  51.  pumManual = 1,                            /* publisher update mode - Manually */
  52.  
  53.  kPartsNotUsed = 0,
  54.  kPartNumberUnknown = -1,                /* misc */
  55.  
  56.  kPreviewWidth = 120,
  57.  kPreviewHeight = 120,
  58.  
  59.  
  60. #define kPublisherDocAliasFormat 'alis'
  61. #define kPreviewFormat 'prvw'
  62. #define kFormatListFormat 'fmts'
  63.  
  64. /* bits for formatsMask */
  65.  
  66.  kPICTformatMask = 1,
  67.  kTEXTformatMask = 2,
  68.  ksndFormatMask = 4,
  69.  
  70. /* Finder types for edition files */
  71.  
  72. #define kPICTEditionFileType 'edtp'
  73. #define kTEXTEditionFileType 'edtt'
  74. #define ksndEditionFileType 'edts'
  75. #define kUnknownEditionFileType 'edtu'
  76.  
  77. /* pseudo-item hits for dialogHooks 
  78.  the first if for NewPublisher or NewSubscriber Dialogs */
  79.  
  80.  emHookRedrawPreview = 150,
  81.  
  82. /* the following are for SectionOptions Dialog */
  83.  emHookCancelSection = 160,
  84.  emHookGoToPublisher = 161,
  85.  emHookGetEditionNow = 162,
  86.  emHookSendEditionNow = 162,
  87.  emHookManualUpdateMode = 163,
  88.  emHookAutoUpdateMode = 164
  89. };
  90. enum {
  91.  
  92. /* the refcon field of the dialog record during a modalfilter 
  93.  or dialoghook contains one the following */
  94.  
  95. #define emOptionsDialogRefCon 'optn'
  96. #define emCancelSectionDialogRefCon 'cncl'
  97. #define emGoToPubErrDialogRefCon 'gerr'
  98.  
  99.  kFormatLengthUnknown = -1
  100. };
  101.  
  102. typedef char SectionType;                /* one byte, stSubscriber or stPublisher */
  103. typedef unsigned long TimeStamp;        /* seconds since 1904 */
  104. typedef unsigned long FormatType;        /* similar to ResType */
  105. typedef Handle EditionRefNum;            /* used in Edition I/O */
  106. /* update modes */
  107. typedef short UpdateMode;                /* sumAutomatic, pumSuspend, etc */
  108.  
  109. struct SectionRecord {
  110.  SignedByte version;                    /* always 0x01 in system 7.0 */
  111.  SectionType kind;                        /* stSubscriber or stPublisher */
  112.  UpdateMode mode;                        /* auto or manual */
  113.  TimeStamp mdDate;                        /* last change in document */
  114.  long sectionID;                        /* app. specific, unique per document */
  115.  long refCon;                            /* application specific */
  116.  AliasHandle alias;                        /* handle to Alias Record */
  117.  long subPart;                            /* which part of container file */
  118.  struct SectionRecord **nextSection;    /* for linked list of app's Sections */
  119.  Handle controlBlock;                    /* used internally */
  120.  EditionRefNum refNum;                    /* used internally */
  121. };
  122.  
  123. typedef struct SectionRecord SectionRecord;
  124. typedef SectionRecord *SectionPtr, **SectionHandle;
  125.  
  126. struct EditionContainerSpec {
  127.  FSSpec theFile;
  128.  ScriptCode theFileScript;
  129.  long thePart;
  130.  Str31 thePartName;
  131.  ScriptCode thePartScript;
  132. };
  133.  
  134. typedef struct EditionContainerSpec EditionContainerSpec;
  135. typedef EditionContainerSpec *EditionContainerSpecPtr;
  136.  
  137. struct EditionInfoRecord {
  138.  TimeStamp crDate;                        /* date EditionContainer was created */
  139.  TimeStamp mdDate;                        /* date of last change */
  140.  OSType fdCreator;                        /* file creator */
  141.  OSType fdType;                            /* file type */
  142.  EditionContainerSpec container;        /* the Edition */
  143. };
  144.  
  145. typedef struct EditionInfoRecord EditionInfoRecord;
  146.  
  147. struct NewPublisherReply {
  148.  Boolean canceled;                        /* O */
  149.  Boolean replacing ;
  150.  Boolean usePart;                        /* I */
  151.  Handle preview;                        /* I */
  152.  FormatType previewFormat;                /* I */
  153.  EditionContainerSpec container;        /* I/O */
  154. };
  155.  
  156. typedef struct NewPublisherReply NewPublisherReply;
  157.  
  158. struct NewSubscriberReply {
  159.  Boolean canceled;                        /* O */
  160.  unsigned char formatsMask;
  161.  EditionContainerSpec container;        /*I/O*/
  162. };
  163.  
  164. typedef struct NewSubscriberReply NewSubscriberReply;
  165.  
  166. struct SectionOptionsReply {
  167.  Boolean canceled;                        /* O */
  168.  Boolean changed;                        /* O */
  169.  SectionHandle sectionH;                /* I */
  170.  ResType action;                        /* O */
  171. };
  172.  
  173. typedef struct SectionOptionsReply SectionOptionsReply;
  174.  
  175.  
  176. typedef pascal Boolean (*ExpModalFilterProcPtr) (DialogPtr theDialog, EventRecord *theEvent,
  177.  short itemOffset, short *itemHit, Ptr yourDataPtr);
  178. typedef pascal short (*ExpDlgHookProcPtr) (short itemOffset,
  179.   short itemHit, DialogPtr theDialog, Ptr yourDataPtr);
  180.  
  181. enum {ioHasFormat,ioReadFormat,ioNewFormat,ioWriteFormat};
  182. typedef unsigned char FormatIOVerb;
  183.  
  184.  
  185. struct FormatIOParamBlock {
  186.  long ioRefNum;
  187.  FormatType format;
  188.  long formatIndex;
  189.  unsigned long offset;
  190.  Ptr buffPtr;
  191.  unsigned long buffLen;
  192. };
  193.  
  194. typedef struct FormatIOParamBlock FormatIOParamBlock;
  195.  
  196.  
  197. typedef pascal short (*FormatIOProcPtr) (FormatIOVerb selector, FormatIOParamBlock *PB);
  198.  
  199. enum {eoOpen,eoClose,eoOpenNew,eoCloseNew,eoCanSubscribe};
  200. typedef unsigned char EditionOpenerVerb;
  201.  
  202.  
  203. struct EditionOpenerParamBlock {
  204.  EditionInfoRecord info;
  205.  SectionHandle sectionH;
  206.  FSSpecPtr document;
  207.  OSType fdCreator;
  208.  long ioRefNum;
  209.  FormatIOProcPtr ioProc;
  210.  Boolean success;
  211.  unsigned char formatsMask;
  212. };
  213.  
  214. typedef struct EditionOpenerParamBlock EditionOpenerParamBlock;
  215.  
  216.  
  217. typedef pascal short (*EditionOpenerProcPtr) (EditionOpenerVerb selector, FormatIOParamBlock *PB);
  218.  
  219.  
  220.  
  221.  
  222. /* 
  223.  Section events now arrive in the message buffer using the AppleEvent format.
  224.  The direct object parameter is an aeTemporaryIDParamType ('tid '). The temporary
  225.  ID's type is rSectionType ('sect') and the 32-bit value is a SectionHandle.
  226.  The following is a sample buffer
  227.  
  228.  name   offset contents
  229.  ----   ------ --------
  230.  
  231.  header   0  'aevt'
  232.  majorVersion 4  0x01
  233.  minorVersion 6  0x01
  234.  endOfMetaData 8  ';;;;' 
  235.  directObjKey 12  '----' 
  236.  paramType  16  'tid ' 
  237.  paramLength  20  0x0008 
  238.  tempIDType  24  'sect' 
  239.  tempID    28  the SectionHandle <-- this is want you want*/
  240.  
  241.  
  242. #define sectionEventMsgClass 'sect'
  243. #define sectionReadMsgID 'read'
  244. #define sectionWriteMsgID 'writ'
  245. #define sectionScrollMsgID 'scrl'
  246. #define sectionCancelMsgID 'cncl'
  247.  
  248. #ifdef __cplusplus
  249. extern "C" {
  250. #endif
  251. pascal OSErr InitEditionPack(void)
  252.  = {0x3F3C,0x0011,0x303C,0x0100,0xA82D}; 
  253. pascal OSErr NewSection(const EditionContainerSpec *container,
  254.                         const FSSpec *sectionDocument,
  255.                         SectionType kind,
  256.                         long sectionID,
  257.                         UpdateMode initalMode,
  258.                         SectionHandle *sectionH)
  259.  = {0x303C,0x0A02,0xA82D}; 
  260. pascal OSErr RegisterSection(const FSSpec *sectionDocument,
  261.                              SectionHandle sectionH,
  262.                              Boolean *aliasWasUpdated)
  263.  = {0x303C,0x0604,0xA82D}; 
  264. pascal OSErr UnRegisterSection(SectionHandle sectionH)
  265.  = {0x303C,0x0206,0xA82D}; 
  266. pascal OSErr IsRegisteredSection(SectionHandle sectionH)
  267.  = {0x303C,0x0208,0xA82D}; 
  268. pascal OSErr AssociateSection(SectionHandle sectionH,
  269.                               const FSSpec *newSectionDocument)
  270.  = {0x303C,0x040C,0xA82D}; 
  271. pascal OSErr CreateEditionContainerFile(const FSSpec *editionFile,
  272.                                         OSType fdCreator,
  273.                                         ScriptCode editionFileNameScript)
  274.  = {0x303C,0x050E,0xA82D}; 
  275. pascal OSErr DeleteEditionContainerFile(const FSSpec *editionFile)
  276.  = {0x303C,0x0210,0xA82D}; 
  277. pascal OSErr OpenEdition(SectionHandle subscriberSectionH,
  278.                          EditionRefNum *refNum)
  279.  = {0x303C,0x0412,0xA82D}; 
  280. pascal OSErr OpenNewEdition(SectionHandle publisherSectionH,
  281.                             OSType fdCreator,
  282.                             const FSSpec *publisherSectionDocument,
  283.                             EditionRefNum *refNum)
  284.  = {0x303C,0x0814,0xA82D}; 
  285. pascal OSErr CloseEdition(EditionRefNum whichEdition,
  286.                           Boolean successful)
  287.  = {0x303C,0x0316,0xA82D}; 
  288. pascal OSErr EditionHasFormat(EditionRefNum whichEdition,
  289.                               FormatType whichFormat,
  290.                               Size *formatSize)
  291.  = {0x303C,0x0618,0xA82D}; 
  292. pascal OSErr ReadEdition(EditionRefNum whichEdition,
  293.                          FormatType whichFormat,
  294.                          void *buffPtr,
  295.                          Size *buffLen)
  296.  = {0x303C,0x081A,0xA82D}; 
  297. pascal OSErr WriteEdition(EditionRefNum whichEdition,
  298.                           FormatType whichFormat,
  299.                           const void *buffPtr,
  300.                           Size buffLen)
  301.  = {0x303C,0x081C,0xA82D}; 
  302. pascal OSErr GetEditionFormatMark(EditionRefNum whichEdition,
  303.                                   FormatType whichFormat,
  304.                                   unsigned long *currentMark)
  305.  = {0x303C,0x061E,0xA82D}; 
  306. pascal OSErr SetEditionFormatMark(EditionRefNum whichEdition,
  307.                                   FormatType whichFormat,
  308.                                   unsigned long setMarkTo)
  309.  = {0x303C,0x0620,0xA82D}; 
  310. pascal OSErr GetEditionInfo(const SectionHandle sectionH,
  311.                             EditionInfoRecord *editionInfo)
  312.  = {0x303C,0x0422,0xA82D}; 
  313. pascal OSErr GoToPublisherSection(const EditionContainerSpec *container)
  314.  = {0x303C,0x0224,0xA82D}; 
  315. pascal OSErr GetLastEditionContainerUsed(EditionContainerSpec *container)
  316.  = {0x303C,0x0226,0xA82D}; 
  317. pascal OSErr GetStandardFormats(const EditionContainerSpec *container,
  318.                                 FormatType *previewFormat,
  319.                                 Handle preview,
  320.                                 Handle publisherAlias,
  321.                                 Handle formats)
  322.  = {0x303C,0x0A28,0xA82D}; 
  323. pascal OSErr GetEditionOpenerProc(EditionOpenerProcPtr *opener)
  324.  = {0x303C,0x022A,0xA82D}; 
  325. pascal OSErr SetEditionOpenerProc(EditionOpenerProcPtr opener)
  326.  = {0x303C,0x022C,0xA82D}; 
  327. pascal OSErr CallEditionOpenerProc(EditionOpenerVerb selector,
  328.                                    EditionOpenerParamBlock *PB,
  329.                                    EditionOpenerProcPtr routine)
  330.  = {0x303C,0x052E,0xA82D}; 
  331. pascal OSErr CallFormatIOProc(FormatIOVerb selector,
  332.                               FormatIOParamBlock *PB,
  333.                               FormatIOProcPtr routine)
  334.  = {0x303C,0x0530,0xA82D}; 
  335. pascal OSErr NewSubscriberDialog(NewSubscriberReply *reply)
  336.  = {0x303C,0x0232,0xA82D}; 
  337. pascal OSErr NewSubscriberExpDialog(NewSubscriberReply *reply,
  338.                                     Point where,
  339.                                     short expansionDITLresID,
  340.                                     ExpDlgHookProcPtr dlgHook,
  341.                                     ExpModalFilterProcPtr filterProc,
  342.                                     void *yourDataPtr)
  343.  = {0x303C,0x0B34,0xA82D}; 
  344. pascal OSErr NewPublisherDialog(NewPublisherReply *reply)
  345.  = {0x303C,0x0236,0xA82D}; 
  346. pascal OSErr NewPublisherExpDialog(NewPublisherReply *reply,
  347.                                    Point where,
  348.                                    short expansionDITLresID,
  349.                                    ExpDlgHookProcPtr dlgHook,
  350.                                    ExpModalFilterProcPtr filterProc,
  351.                                    void *yourDataPtr)
  352.  = {0x303C,0x0B38,0xA82D}; 
  353. pascal OSErr SectionOptionsDialog(SectionOptionsReply *reply)
  354.  = {0x303C,0x023A,0xA82D}; 
  355. pascal OSErr SectionOptionsExpDialog(SectionOptionsReply *reply,
  356.                                      Point where,
  357.                                      short expansionDITLresID,
  358.                                      ExpDlgHookProcPtr dlgHook,
  359.                                      ExpModalFilterProcPtr filterProc,
  360.                                      void *yourDataPtr)
  361.  = {0x303C,0x0B3C,0xA82D}; 
  362. #ifdef __cplusplus
  363. }
  364. #endif
  365.  
  366. #endif
  367.